package threading;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lishuo
 * Date: 2023-03-25
 * Time: 21:20
 */
//有括号就不加;了
public class ThreadDemo5 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("hello t");
            }
        },"t");

        t.start();
        while (true) {
            Thread.sleep(1000);
            System.out.println("hello main");
        }
    }
}
